//
//  RankTableviewSecondCell.m
//  FloatClouds
//
//  Created by 黄威 on 16/9/1.
//  Copyright © 2016年 黄威. All rights reserved.
//

#import "RankTableviewSecondCell.h"
#import "Masonry.h"
@implementation RankTableviewSecondCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.imageViewLift  = [[UIImageView alloc]init];
        self.imageViewLift.layer.masksToBounds = YES;
        self.imageViewLift.layer.cornerRadius = 5;
        [self.contentView addSubview:self.imageViewLift];
       // self.imageViewLift.backgroundColor = [UIColor redColor];
        
        self.name = [[BaseLabel alloc]init];
        self.name.font = [UIFont fontWithName:@"Helvetica" size:19];
        self.name.numberOfLines = 1;
        [self.contentView addSubview:self.name];
        
        
        self.catrame = [[BaseLabel alloc]init];
        self.catrame.text = @"焦油含量";
        self.catrame.font = [UIFont fontWithName:@"Helvetica" size:15];
        self.catrame.tintColor = [UIColor grayColor];
        [self.contentView addSubview:self.catrame];
        
        self.catrameinput = [[BaseLabel alloc]init];
        self.catrameinput.font = [UIFont fontWithName:@"Helvetica" size:15];
        [self.contentView addSubview:self.catrameinput];
        
        
        
        self.price = [[BaseLabel alloc]init];
        self.price.text = @"参考价格";
        self.price.font = [UIFont fontWithName:@"Helvetica" size:15];
        [self.contentView addSubview:self.price];
        
        
        self.priceinput = [[BaseLabel alloc]init];
        self.priceinput.font = [UIFont fontWithName:@"Helvetica" size:15];
        [self.contentView addSubview:self.priceinput];
        
        
        self.numberOfLikeTitle = [[BaseLabel alloc]init];
        self.numberOfLikeTitle.font = [UIFont fontWithName:@"Helvetica" size:15];
        self.numberOfLikeTitle.text = @"星级评分";
        [self.contentView addSubview:self.numberOfLikeTitle];
        
        
        self.numberOfLike = [[BaseLabel alloc]init];
        self.numberOfLike.font = [UIFont fontWithName:@"Helvetica" size:15];
        [self.contentView addSubview:self.numberOfLike];
        
         self.diandian = [[BaseButton alloc]init];
        [self.diandian setTintColor:[UIColor whiteColor]];
        [self.imageViewLift addSubview:self.diandian];
        self.diandian.backgroundColor = [UIColor colorWithRed:254.0 / 255 green:208.0 / 255 blue:55.0 / 255 alpha:1];
        
    }
    
    return self;
    
}

- (void)layoutSubviews{
    
    [super layoutSubviews];
    
    [self.imageViewLift mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(self.mas_width).multipliedBy(0.35);
        make.top.left.mas_equalTo(5);
        make.bottom.mas_equalTo(-5);
        
    }];
    
    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(5);
        make.left.mas_equalTo(self.imageViewLift.mas_right).mas_equalTo(20);
        make.width.mas_equalTo(self.mas_width).multipliedBy(0.5);
        make.height.mas_equalTo(self.mas_height).multipliedBy(0.3);
    }];
    
    [self.catrame mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.name.mas_bottom).mas_equalTo(5);
        make.left.mas_equalTo(self.imageViewLift.mas_right).mas_equalTo(20);
        make.width.mas_equalTo(self.mas_width).multipliedBy(0.3);
        make.height.mas_equalTo(self.mas_height).multipliedBy(0.15);
    }];
    
    [self.catrameinput mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.name.mas_bottom).mas_equalTo(5);
        make.left.mas_equalTo(self.catrame.mas_right).mas_equalTo(20);
        make.width.mas_equalTo(self.mas_width).multipliedBy(0.2);
        make.height.mas_equalTo(self.mas_height).multipliedBy(0.15);
    }];
    
    [self.price mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.catrame.mas_bottom).mas_equalTo(5);
        make.trailing.mas_equalTo(self.catrame);
        make.width.mas_equalTo(self.mas_width).multipliedBy(0.3);
        make.height.mas_equalTo(self.mas_height).multipliedBy(0.15);
        
    }];
    
    [self.priceinput mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(self.mas_width).multipliedBy(0.2);
        make.height.mas_equalTo(self.mas_height).multipliedBy(0.15);
        make.top.mas_equalTo(self.catrame.mas_bottom).mas_equalTo(5);
        make.trailing.mas_equalTo(self.catrameinput);
    }];
    
    [self.numberOfLikeTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.price.mas_bottom).mas_equalTo(5);
        make.trailing.mas_equalTo(self.price);
        make.width.mas_equalTo(self.mas_width).multipliedBy(0.3);
        make.height.mas_equalTo(self.mas_height).multipliedBy(0.15);
        
    }];
    
    
    [self.numberOfLike mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(self.mas_width).multipliedBy(0.2);
        make.height.mas_equalTo(self.mas_height).multipliedBy(0.15);
        make.top.mas_equalTo(self.priceinput.mas_bottom).mas_equalTo(5);
        make.trailing.mas_equalTo(self.catrameinput);
    }];
    
    self.diandian.layer.masksToBounds = YES;
    self.diandian.layer.cornerRadius = 15;
    self.diandian.frame = CGRectMake(0, 0, 30, 30);
}
@end
